package net.huashitong.ssydt.money.entity.vo;

import java.io.Serializable;

/**
 * @author hemj
 * @version 2017/7/27
 */
@Deprecated
public class PaginationInVO implements Serializable{
    /**
     * 读取记录数
     */
    private int pageSize;
    /**
     * 当前页
     */
    private int pageNumber;
    /**
     * 行偏移
     */
    private int pageRowOffset;

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
        calcRowOffset();
    }

    public int getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(int pageNumber) {
        if (pageNumber < 1)
            pageNumber = 1;
        this.pageNumber = pageNumber;
        calcRowOffset();
    }

    public int getPageRowOffset() {
        return pageRowOffset;
    }

    public void setPageRowOffset(int pageRowOffset) {
        this.pageRowOffset = pageRowOffset;
    }

    private void calcRowOffset() {
        if (pageNumber > 0 && pageSize > 0) {
            pageRowOffset = pageNumber * pageSize - pageSize;
        }
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("PaginationInVO{");
        sb.append("pageSize=").append(pageSize);
        sb.append(", pageNumber=").append(pageNumber);
        sb.append(", pageRowOffset=").append(pageRowOffset);
        sb.append('}');
        return sb.toString();
    }
}
